// 图片保存到数组中 找到list1建立点击事件
let arr = ['../image/5.jpg', '../image/6.jpg', '../image/7.jpg', '../image/8.jpg', '../image/9.jpg', '../image/10.jpg'];
function getEle() {
    let list = document.getElementsByClassName('list1');
    console.log(list);
    for (let i = 0; i < list.length; i++) {
        list[i].onclick = function () {
            let masking = document.createElement('div');
            //masking.style.width = '100%';
            masking.style.height = '1200px';
            masking.style.backgroundColor = 'rgba(180,180,180,0.6)';
            box.appendChild(masking);
            console.log(masking);
            let img = document.createElement('img');
            img.setAttribute('src', arr[i]);
            img.style.width = '410px';
            img.style.height = '180px';
            box.appendChild(img);
            console.log(img);
            let del = document.createElement('span');
            del.setAttribute('id', 'span1');
            del.style.width = '20px';
            del.style.height = '20px';
            del.innerHTML = 'X';
            del.style.backgroundColor = 'red';
            del.style.display = 'block';
            box.appendChild(del);

            let dell = document.getElementById('span1');
            dell.onclick = function () {
                box.removeChild(dell);
                box.removeChild(img);
                box.removeChild(masking);
            }

        }

    }
}
getEle();

